import datetime

from tortoise.contrib.pydantic import pydantic_model_creator
from tortoise.models import Model
from tortoise import fields


class Photo(Model):
    id = fields.IntField(pk=True)
    name = fields.CharField(max_length=255)
    href = fields.CharField(max_length=255, null=True)
    mime = fields.CharField(max_length=50)
    size = fields.CharField(max_length=30)
    create_time = fields.DatetimeField(auto_now_add=True)

    class Meta:
        table = "admin_photo"


PhotoSchema = pydantic_model_creator(Photo)
